package com.gimi.cloud.bbp.manage.service.mall.impl;

import com.gimi.cloud.bbp.dao.dao.mall.MallSuggestDao;
import com.gimi.cloud.bbp.dao.myMapper.core.query.QueryParam;
import com.gimi.cloud.bbp.dto.mall.MallSuggestDTO;
import com.gimi.cloud.bbp.manage.service.mall.MallSuggestService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 意见反馈服务
 * @author 李林峰
 * @version 1.0
 * @Description
 * @create 2018年1月31日
 */
@Service
public class MallSuggestServiceImpl implements MallSuggestService {
	@Autowired MallSuggestDao mallSuggestDao;

	@Override
	public List<MallSuggestDTO> queryList(MallSuggestDTO dto, boolean isPaging) {
		if (isPaging){
            PageHelper.startPage(dto.getPageNums(),dto.getPageSizes());
        }
        QueryParam param = new QueryParam();
        param.setSql("SELECT sug.*,info.real_name,info.nick " +
				" FROM mall_suggest sug" +
				" LEFT JOIN rd_user_info info ON info.user_id = sug.user_id" +
				" WHERE sug.is_delete =0  AND sug.su_mobile_phone LIKE '%'||:suMobilePhone||'%'" +
				" AND sug.su_suggest LIKE '%'||:suSuggest||'%'" +
				" order by sug.add_time desc");
        param.setParamObject(dto);
        return mallSuggestDao.selectListDTOBySql(param);
	}

}
